var TopScene = cc.Layer.extend({
    ctor: function () {
        this._super();
        daifugo.topscene = this;
        this.init();
    },
    init: function () {
        var size = cc.Director.getInstance().getWinSize();
        var mSprTop = cc.Sprite.create(g_imageRes.s_top);
        mSprTop.setPosition(size.width / 2, size.height / 2);
        this.addChild(mSprTop);
        var mSprButtonPlay = cc.Sprite.create(g_imageRes.s_top_btn_play);

        // Create button to play game
        var mBtnPlay = cc.ControlButton.create(mSprButtonPlay);
        mBtnPlay.setAdjustBackgroundImage(true);
        mBtnPlay.setPosition(size.width * 0.325, size.height * 0.3);
        mBtnPlay.addTargetWithActionForControlEvents(this, function () {
            playSound('tap');
            var nextScene = cc.Scene.create();
            var nextLayer = new WarningScene;
            nextScene.addChild(nextLayer);
            cc.Director.getInstance().replaceScene(nextScene);
        }, cc.CONTROL_EVENT_TOUCH_DOWN);
        this.addChild(mBtnPlay);
    }
});

var gotoTopScene = function(){
    var nextScene = cc.Scene.create();
    var nextLayer = new TopScene;
    nextScene.addChild(nextLayer);
    cc.Director.getInstance().replaceScene(nextScene);
};
